package com.wsq.servicewindow;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.view.WindowManager;

import androidx.annotation.Nullable;

/**
 * Date:2021/7/7
 * Time:14:30
 * author:wushengqi
 */
public class BackgroundService extends Service {
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        showDialog();
        return super.onStartCommand(intent, flags, startId);
    }

    private void showDialog(){
        GazeViewDialog gazeViewDialog = new GazeViewDialog(getApplicationContext());
        gazeViewDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        gazeViewDialog.show();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
